<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>课程评价</title>
    <script src="js/flexible.js"></script>
    <link rel="stylesheet" href="css/flexible.css">
    <link rel="stylesheet" href="css/reset.css">
    <link rel="stylesheet" href="css/style.css">
    <link rel="stylesheet" href="css/vant.css">
    <script src="js/jquery-3.3.1.min.js"></script>
    <script src="js/vue/vue.js"></script>
    <script src="js/vue/axios.js"></script>
    <script src="js/vue/MD5.js"></script>
    <script src="js/vue/vant.js"></script>
    <script src="js/vue/qs.js"></script>
</head>
<body style="background-color: #f6f6f6;">
<div id="app">
    <div class="pingjia_score">
        <div class="pingfen">
            <div class="title">总体评分</div>
            <div class="score">
                <van-rate color="#ee0a24" v-model="from.Score" />
            </div>
            <div v-if="from.Score=='2'" class="pingjia" style="color: red">不好</div>
            <div v-if="from.Score=='3'" class="pingjia" style="color: red">一般</div>
            <div v-if="from.Score=='5'" class="pingjia" style="color: red">很好</div>
        </div>
        <div class="clear"></div>
        <div class="pingfen">
            <div class="title">上课时间</div>
            <div class="score">
                <van-rate color="#ee0a24" v-model="from.Classtime"  />
            </div>
            <div v-if="from.Classtime=='2'" class="pingjia" style="color: red">迟到好久</div>
            <div v-if="from.Classtime=='3'" class="pingjia" style="color: red">迟到一会</div>
            <div v-if="from.Classtime=='5'" class="pingjia" style="color: red">准时</div>
        </div>
        <div class="clear"></div>
        <div class="pingfen">
            <div class="title">上课内容</div>
            <div class="score">
                <van-rate color="#ee0a24" v-model="from.Contents"  />
            </div>
            <div v-if="from.Contents=='2'" class="pingjia" style="color: red">乏味</div>
            <div v-if="from.Contents=='3'" class="pingjia" style="color: red">一般</div>
            <div v-if="from.Contents=='5'" class="pingjia" style="color: red">丰富</div>
        </div>
        <div class="clear"></div>
        <div class="pingfen">
            <div class="title">上课态度</div>
            <div class="score">
                <van-rate color="#ee0a24" v-model="from.Manner"  />
            </div>
            <div v-if="from.Manner=='2'" class="pingjia" style="color: red">恶劣</div>
            <div v-if="from.Manner=='3'" class="pingjia" style="color: red">一般</div>
            <div v-if="from.Manner=='5'" class="pingjia" style="color: red">很好</div>
        </div>
        <div class="clear"></div>
    </div>
    <div class="h10"></div>
    <div class="pingjia_content">
        <div class="content"><img src="images/shuru.png" alt="评价">您的评价对我们很重要哦~</div>
        <div>
            <textarea class="pingjia_srk" maxlength="300"v-model="from.Desc"></textarea>
        </div>
        <div class="pingjia_ts">0/300字</div>
        <div class="pingjia_nm">
            <van-checkbox v-model="Anonymous" checked-color="#07c160">匿名评价</van-checkbox>
    </div>
    <div class="pingjia_btn" @click="sumbit">提交评价</div>
</div>
</body>
<script>
var vm=new Vue({
    el: '#app',
    data: {
        from:{
            Currid:"",
            Currtype:"",
            Score:"",
            Classtime:"",
            Contents:"",
            Manner:"",
            Desc:"",
            Anonymous:false,
            Ctime:'',
            Cdate:''
        },
		Anonymous:false
    },
    created(){
        this.setCanS()
    },
    methods:{
         //设置参数
			 setCanS(){
                let Request = new Object()
                Request = GetRequest()
                this.from.Currid = Request['currid']
                this.from.Currtype = Request['type']
                this.from.Cdate=Request['Ctime']
                this.from.Ctime=Request['Cdate']
        },
        //提交评价
        sumbit(){
            if(this.Anonymous==true){
                this.from.Anonymous='1'
            }else{
                this.from.Anonymous='0'
            }
            let from=JSON.stringify(this.from)
            let sign=md5(from)
            const params={
                from:from,
                sign:sign
            }
            getVs()
            axios.post('/mobileapi/member/curriculum.php?act=evaluate',Qs.stringify(params)).then(data =>{
                console.log(data.data)
                let { msg, code,user} = data.data
                    if (code !== 200) {
                        window.vant.Toast.fail(data.data.msg);
                    } else {
                        window.vant.Toast.success('评价成功')
                         this.timer = setTimeout(this.order(), 2000);
                        //this.getlists()
                    }
                }).catch(function (error) { 
                    console.log(error); 
            });
        },
        order(){
            window.location.href='curriculum_t.html'
        },
    }
})
</script>
</html>